ContextCompat
Helper for accessing features in Context.
Inheritors
Types
Link copied to clipboard
Properties
Link copied to clipboard
Flag for registerReceiver: The receiver can receive broadcasts from other Apps.
Link copied to clipboard
Flag for registerReceiver: The receiver cannot receive broadcasts from other Apps.
Link copied to clipboard
Flag for registerReceiver: The receiver can receive broadcasts from Instant Apps.
Functions
Link copied to clipboard
open fun checkSelfPermission(@NonNull context: @NonNull Context, @NonNull permission: @NonNull String): Int
Determine whether you have been granted a particular permission.
Link copied to clipboard
@NonNull
Return a new Context object for the current Context but attribute to a different tag.
Link copied to clipboard
@Nullable
Return a new Context object for the current Context but whose storage APIs are backed by device-protected storage.
Link copied to clipboard
Attribution can be used in complex apps to logically separate parts of the app.
Link copied to clipboard
Returns the absolute path to the application specific cache directory on the filesystem designed for storing cached code.
Link copied to clipboard
@Nullable
Returns a color state list associated with a particular resource ID.
Link copied to clipboard
Gets the context which respects the per-app locales locale.
Link copied to clipboard
Returns the absolute path to the directory on the filesystem where all private files belonging to this app are stored.
Link copied to clipboard
Get the display this context is associated with or the default display as the fallback if the context is not associated with any Display.
Link copied to clipboard
@Nullable
Returns a drawable object associated with a particular resource ID.
Link copied to clipboard
Returns absolute paths to application-specific directories on all external storage devices where the application can place cache files it owns.
Link copied to clipboard
open fun getExternalFilesDirs(@NonNull context: @NonNull Context, @Nullable type: @Nullable String): @NonNull Array<File>
Returns absolute paths to application-specific directories on all external storage devices where the application can place persistent files it owns.
Link copied to clipboard
Return an Executor that will run enqueued tasks on the main thread associated with this context.
Link copied to clipboard
Returns the absolute path to the directory on the filesystem similar to getFilesDir.
Link copied to clipboard
Returns absolute paths to application-specific directories on all external storage devices where the application's OBB files (if there are any) can be found.
Link copied to clipboard
Link copied to clipboard
@Nullable
Gets the name of the system-level service that is represented by the specified class.
Link copied to clipboard
Indicates if the storage APIs of this Context are backed by device-encrypted storage.
Link copied to clipboard
@Nullable
@Nullable
Register a broadcast receiver.
Link copied to clipboard
open fun startActivities(@NonNull context: @NonNull Context, intents: @NonNull Array<Intent>): Boolean
open fun startActivities(@NonNull context: @NonNull Context, intents: @NonNull Array<Intent>, @Nullable options: @Nullable Bundle): Boolean
Start a set of activities as a synthesized task stack, if able.
Link copied to clipboard
open fun startActivity(@NonNull context: @NonNull Context, @NonNull intent: @NonNull Intent, @Nullable options: @Nullable Bundle)
Start an activity with additional launch information, if able.
Link copied to clipboard
open fun startForegroundService(@NonNull context: @NonNull Context, @NonNull intent: @NonNull Intent)
startForegroundService() was introduced in O, just call startService for before O.